//
//  WaybillStatus.m
//  express
//
//  Created by dd on 12/8/14.
//  Copyright (c) 2014 yunqi. All rights reserved.
//


#import "Waybill.h"
#import "DXUtil.h"
#import "WaybillStatus.h"
#import "DXKit.h"

@implementation WaybillStatus

- (NSString *)content
{
    NSString *status = _data[@"status"];
    NSString *operatorType = _data[@"operator_type"];
    NSString *content = @"";
    switch (status.integerValue)
    {
        case WAYBILL_STATUS_INIT:
        {
            content = @"用户发件";
        } break;
        case WAYBILL_STATUS_RECEIVING:
        {
            content = @"快递员接单";
        } break;
        case WAYBILL_STATUS_RECEIVE_SUCCESS:
        {
            if (operatorType.integerValue == WAYBILL_STATUS_OPERATOR_TYPE_USER)
            {
                content = @"用户确认取件成功";
            }
            else if (operatorType.integerValue == WAYBILL_STATUS_OPERATOR_TYPE_COURIER)
            {
                content = @"快递员确认取件成功";
            }
            else
            {
                content = @"取件成功";
            }
        } break;
        case WAYBILL_STATUS_RECEIVE_FAIL:
        {
            content = @"取件失败";
        } break;
        case WAYBILL_STATUS_IN_TRANSIT:
        {
            content = @"快件已进入快递公司处理";
        } break;
        case WAYBILL_STATUS_DELIVERING:
        {
            content = @"派件中";
        } break;
        case WAYBILL_STATUS_DELIVER_SUCCESS:
        {
            if (operatorType.integerValue == WAYBILL_STATUS_OPERATOR_TYPE_USER)
            {
                content = @"用户确认派件成功";
            }
            else if (operatorType.integerValue == WAYBILL_STATUS_OPERATOR_TYPE_COURIER)
            {
                content = @"快递员确认派件成功";
            }
            else
            {
                content = @"派件成功";
            }
        } break;
        case WAYBILL_STATUS_DELIVER_FAIL:
        {
            content = @"派件失败";
        } break;
        case WAYBILL_STATUS_LOST:
        {
            content = @"快件丢失";
        } break;
        case WAYBILL_STATUS_FAIL:
        {
            content = @"错误";
        } break;
        case WAYBILL_STATUS_CANCEL:
        {
            content = @"取消快件";
        }break;
        default:
            content = @"";
            break;
    }
    
    NSString *created = _data[@"created"];
    content = [NSString stringWithFormat:@"%@ %@", [DX timeFormat:created], content];
    return content;
}

@end
